﻿using System;
using System.Collections;
using Castle.MonoRail.Framework;
using Castle.MonoRail.Framework.Helpers;
using VS.Model;
using VS.Web.Helper;

namespace VS.Web.Components
{
    public class pager : ViewComponent
    {
        private IList _products;

        private string _id;
        [ViewComponentParam]
        public string ID
        {
            get { return _id; }
            set { _id = value; }
        }

        public override void Initialize()
        {
            _products = VS_PType.Find(int.Parse(_id)).VS_Products;

            base.Initialize();
        }

        public override void Render()
        {
            PropertyBag["PTypes"] = PaginationHelper.CreatePagination(_products, 20, 1);
            PropertyBag["ID"] = _id;
            base.Render();
        }
    }
}